<?php
namespace Biz\model\salesRebate;

use Doraemon\pockets\datebase\BaseDbModel;
use Kafka\Exception;

class SalesCompany extends BaseDbModel
{
    const _CONFIG_FILE_ = 'db_shop';

    const _CONFIG_SELECT_ = 'db_sales_rebate';

    const _DATABASE_ = 'biz_sales_rebate';

    const _TABLE_NAME = 'sales_company';

    const STATUS_NORMAL = 0;
    const STATUS_DELETE = 9;


    public static function getAllByWhere($files = '*', $where = [])
    {
        $data = self::select($files, $where);
        return $data;
    }

    public static function getOneByWhere($files = '*', $where = [])
    {
        $data = self::get($files, $where);
        return $data;
    }


    public static function save($data)
    {
        $getOne = self::get('id', ['uid'=>$data['uid']]);
        if($getOne){
            return false;
        }
        try {
            self::insert($data);
            return self::id();
        }catch (Exception $e){
            return false;
        }
    }

}